/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package estg.dae.projecto.broker.model;

import estg.dae.projecto.bank.IBank;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author mario
 */
@Entity
@Table(name="Banks",
uniqueConstraints=@UniqueConstraint(columnNames={"code"}))
public class Bank implements IBank, Serializable {

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id;
    private String code;
    private String name;
    private String address;
    private String phone;
    private String responsibleName;
    private String responsibleEmail;
    private String shortName;
    private String hostName;
    private int hostPort;
    @Temporal(javax.persistence.TemporalType.TIME)
    private Date timeOfflineTransfers;
    private boolean active;

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * @param code the code to set
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the address
     */
    public String getAddress() {
        return address;
    }

    /**
     * @param address the address to set
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * @return the phone
     */
    public String getPhone() {
        return phone;
    }

    /**
     * @param phone the phone to set
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * @return the responsableName
     */
    public String getResponsibleName() {
        return responsibleName;
    }

    /**
     * @param responsableName the responsableName to set
     */
    public void setResponsibleName(String responsibleName) {
        this.responsibleName = responsibleName;
    }

    /**
     * @return the responsableEmail
     */
    public String getResponsibleEmail() {
        return responsibleEmail;
    }

    /**
     * @param responsableEmail the responsableEmail to set
     */
    public void setResponsibleEmail(String responsibleEmail) {
        this.responsibleEmail = responsibleEmail;
    }

    /**
     * @return the shortName
     */
    public String getShortName() {
        return shortName;
    }

    /**
     * @param shortName the shortName to set
     */
    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    /**
     * @return the hostName
     */
    public String getHostName() {
        return hostName;
    }

    /**
     * @param hostName the hostName to set
     */
    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    /**
     * @return the serviceLocation
     */
    public int getHostPort() {
        return hostPort;
    }

    /**
     * @param serviceLocation the serviceLocation to set
     */
    public void setHostPort(int hostPort) {
        this.hostPort = hostPort;
    }

    /**
     * @return the timeOfflineTransfers
     */
    public Date getTimeOfflineTransfers() {
        return timeOfflineTransfers;
    }

    /**
     * @param timeOfflineTransfers the timeOfflineTransfers to set
     */
    public void setTimeOfflineTransfers(Date timeOfflineTransfers) {
        this.timeOfflineTransfers = timeOfflineTransfers;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Bank() {

    }
    
    public Bank(IBank bank) {
        code = bank.getCode();
        name = bank.getName();
        address = bank.getAddress();
        phone = bank.getPhone();
        responsibleName = bank.getResponsibleName();
        responsibleEmail = bank.getResponsibleEmail();
        shortName = bank.getShortName();
        hostName = bank.getHostName();
        hostPort = bank.getHostPort();
    }

}
